﻿<!DOCTYPE HTML>
<html>

<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
	<link rel="stylesheet" type="text/css" href="../static/h-ui/css/H-ui.min.css" />
	<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/H-ui.admin.css" />
	<link rel="stylesheet" type="text/css" href="../lib/Hui-iconfont/1.0.8/iconfont.css" />
	<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/skin/default/skin.css" id="skin" />
	<link rel="stylesheet" type="text/css" href="../static/h-ui.admin/css/style.css" />
	<script type="text/javascript" src="../lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="../lib/layer/2.4/layer.js"></script>
	<script type="text/javascript" src="../static/h-ui/js/H-ui.min.js"></script>
	<script type="text/javascript" src="../static/h-ui.admin/js/H-ui.admin.js"></script>
	<!-- 分页插件 -->
	<link rel="stylesheet" href="../lib/page/page.css">
	<script src="../lib/page/paging.js"></script>
	<!--/_footer 作为公共模版分离出去-->

	<!--请在下方写此页面业务相关的脚本-->
	<script type="text/javascript" src="../lib/My97DatePicker/4.8/WdatePicker.js"></script>
	<script type="text/javascript" src="../lib/jqueryPage/paging.min.js"></script>
	<script type="text/javascript" src="../lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="../lib/laypage/1.2/laypage.js"></script>
	<script src="../lib/jrender.min.js" type="text/javascript"></script>
	<script type="text/javascript" src="../js/config.js"></script>
	<script>
		$(function () {
			// 时间格式化
			$.views.converters("timeFilter", function (val) {
				var fmt = "yyyy-MM-dd hh:mm:ss";
				var data = new Date(val);

				var o = {
					"M+": data.getMonth() + 1, //月份 
					"d+": data.getDate(), //日 
					"h+": data.getHours(), //小时 
					"m+": data.getMinutes(), //分 
					"s+": data.getSeconds(), //秒 
					"q+": Math.floor((data.getMonth() + 3) / 3), //季度 
					"S": data.getMilliseconds() //毫秒 
				};

				if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (data.getFullYear() + "").substr(4 - RegExp.$1.length));
				for (var k in o)
					if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : ((
						"00" +
						o[k]).substr(("" + o[k]).length)));

				return fmt;
			});

			$.views.converters("json", function (val) {
				return JSON.stringify(val);
			});

			// 获取列表
			var account = $.cookie('useradmin__adminName');
			var md5 = $.cookie('admin__code');
			var search_obj = {};


			ajaxPage(1);

			function ajaxPage(num) {
				$.ajax({
					type: 'POST',
					url: $.webConfig.basicUrl + '/chuyangPay/admin/getList',
					data: {
						account: account,
						md5: md5,
						page: num,
						type: search_obj['type'] ? search_obj['type'] : 0,
						dfType: search_obj['dfType'] ? search_obj['dfType'] : null,
						userMerchantNo: search_obj['userMerchantNo'] ? search_obj['userMerchantNo'] : null,
						account: search_obj['account'] ? search_obj['account'] : null,
						userName: search_obj['userName'] ? search_obj['userName'] : null,
						icpNo: search_obj['icpNo'] ? search_obj['icpNo'] : null
					},
					dataType: "json",
					success: function (data) {
						if (data['code'] == 200) {
							jsRenderTpl = $.templates('#j-specCard');
							finalTpl = jsRenderTpl(data);
							$('.j-specCard-box').html(finalTpl);

							//分页
							$("#page").paging({
								pageNo: num,
								totalPage: Math.ceil(data.return_count / 18),
								totalSize: data.return_count,
								callback: function (num) {
									ajaxPage(num)
								}
							})

						} else {
							layer.alert(data['msc']);
						}
					},
					error: function (err) {
						console.log(err);
					}
				})
			}

			// 查询
			$("#search-btn").click(function () {
				var type = $("#type").val();
				var dfType = $("#dfType").val();
				var userMerchantNo = $("#userMerchantNo").val();
				var account = $("#account").val();
				var userName = $('#userName').val();
				var icpNo = $('#icpNo').val();
				var start_time = $('#start_time').val();
				var end_time = $('#end_time').val();

				search_obj['type'] = type;
				search_obj['dfType'] = dfType;
				search_obj['userMerchantNo'] = userMerchantNo;
				search_obj['account'] = account;
				search_obj['userName'] = userName;
				search_obj['icpNo'] = icpNo;
				search_obj['start_time'] = start_time;
				search_obj['end_time'] = end_time;

				ajaxPage(1);

			})


			// 修改 是否需要审核
			$('body').on('change', '.daifu-select', function (e) {
				var _this = $(this);
				var select_val = this.value;
				if(select_val==0){
					_this.val(1);				
				}else{
					_this.val(0);	
				}
				//询问框
				layer.confirm('确定修改审核状态？', {
					btn: ['确定', '取消'], //按钮
					icon: 3
				}, function () {
					console.log($.parseJSON(_this.attr('data')));
					layer.msg('修改成功', {
						icon: 1
					});
				}, function () {


				});
			})

		})
	</script>
	<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
	<title>商户列表</title>
</head>

<body>
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页
		<span class="c-gray en">&gt;</span> 商户列表
		<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);"
		    title="刷新">
			<i class="Hui-iconfont">&#xe68f;</i>
		</a>
	</nav>
	<div class="page-container">
		<div class="text-c">
			开始时间:
			<input id="start_time" class="Wdate input-text" style="width:160px" type="text" onfocus="WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})"
			/> 结束时间:
			<input id="end_time" class="Wdate input-text" style="width:160px" type="text" onfocus="WdatePicker({skin:'twoer',dateFmt:'yyyy-MM-dd HH:mm:ss',readOnly:true})"
			/>
			接口状态：
			<span class="select-box inline">
				<select id="type" class="select">
					<option value="">全部</option>
					<option value="1">已开通</option>
					<option value="2">未开通</option>
				</select>
			</span>
			代付审核：
			<span class="select-box inline">
				<select id="dfType" class="select">
					<option value="">全部</option>
					<option value="1">需要审核</option>
					<option value="0">不需要</option>
				</select>
			</span>
			<br />
			<div class="mt-10"></div>
			
			
			<input type="text" id="userMerchantNo" placeholder=" 商户号" style="width:250px" class="input-text">
			<input type="text" id="account" placeholder=" 账号" style="width:250px" class="input-text">
			<input type="text" id="userName" placeholder=" 身份证名称" style="width:250px" class="input-text">
			<input type="text" id="icpNo" placeholder=" ICP备案登记号" style="width:250px" class="input-text">
			<button id="search-btn" class="btn btn-success" type="submit">
				<i class="Hui-iconfont">&#xe665;</i> 检索</button>
		</div>
		<div class="mt-20">
			<table class="table table-border table-bordered table-bg table-hover table-sort table-responsive">
				<thead>
					<tr class="text-c">
						<th>用户id</th>
						<th width="">商户号</th>
						<th>账号</th>
						<th width="">身份证名称</th>
						<th width="">接口状态</th>
						<th width="">使用状态</th>
						<th width="">ICP备案登记号</th>
						<th>创建时间</th>
						<th>代付审核</th>
					</tr>
				</thead>
				<tbody class="j-specCard-box">

				</tbody>

				<script type="text/x-jsrender" id="j-specCard">

					{{for data}}
					<tr class="text-c">
						<td>
							{{:userNo}}
						</td>
						<td>
							{{:userMerchantNo}}
						</td>
						<td>
							{{:account}}
						</td>
						<td>
							{{:userName}}
						</td>
						<td>
							{{if type == 1}} 未开通 {{else type == 2}} 已开通 {{/if}}

						</td>
						<td>
							{{if isdel == 1}} 已删除 {{else isdel == 2}} 正常使用 {{else isdel == 3}} 未审核 {{/if}}
						</td>
						<td>
							{{:icpNo}}
						</td>
						<td>
							{{timeFilter:userTime}}
						</td>
						<td>
							<span class="select-box">
								<select class="select valid daifu-select" data='{{json:#data}}' size="1">
									<option value="1" {{if dfType==1}} selected {{/if}}>需要审核</option>
									<option value="0" {{if dfType==0}} selected {{/if}}>不需要</option>
								</select>
							</span>
						</td>
					</tr>

					{{/for}}
				</script>
			</table>
		</div>
	</div>

</body>

</html>